package com.flyan.game.motafx.core.event.listener;

import com.flyan.game.motafx.core.event.enums.EventListenerTypeEnum;
import com.flyan.game.motafx.core.map.FloorMap;
import com.flyan.game.motafx.core.map.MapPosition;
import com.flyan.game.motafx.core.util.core.GameUtils;

/**
 * 移动到目标位置事件监听器
 *
 * @author flyan
 * @version 1.0
 * @email flyan_by_chenu@sina.com
 * @since 2025/2/11
 */
public class MoveToTargetEventListener extends EventListener {

    /**
     * 移动到的目的位置
     */
    private final MapPosition target;

    public MoveToTargetEventListener(Integer floorNumber, MapPosition target) {
        super(floorNumber);
        this.target = target;
    }

    @Override
    public String type() {
        return EventListenerTypeEnum.MOVE_TO_TARGET.getCode();
    }

    @Override
    public boolean isOccur() {
        /* 勇士位置位于目的地事件发生 */
        FloorMap currentFloor = GameUtils.app().towerMap.getCurrentFloor();
        return target.equals(currentFloor.getBravePosition());
    }

}
